package cn.tedu.egweibo.conmon.response;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class JsonResult {
    public Integer state;
    public String message;
    public Object data;

    public JsonResult(StataCode stataCode, Object data) {
        this.state = stataCode.getState();
        this.message = stataCode.getMessage();
        this.data = data;
    }

    public JsonResult(StataCode stataCode) {
        this.state = stataCode.getState();
        this.message = stataCode.getMessage();
    }

    public static JsonResult ok(){
        return new JsonResult(StataCode.OPERATION_SUCCESS);
    }
    public static JsonResult ok(Object data){
        return new JsonResult(StataCode.OPERATION_SUCCESS,data);
    }
}
